package eval.results;

import java.io.Serializable;

public class ResultsData implements Serializable, IResultsData {

	private static final long serialVersionUID = 1L;
	
	private String  engineType;
	private double[] computationTime;
	private double totalExperimentTimeInSec;
	private int experimentTicks;
	private int[] vmRelocate;
	private int[] numberOfHostAtCloud;
	private int[] numberOfOpenHostAtCloud;
	private int[] numberOfCloseHostAtCloud;
	private int[] numberOfHostTurnOnAtCloud;
	private int[] numberOfHostTurnOffAtCloud;
	private int[] numberOfHostCandidatesForClosing;
	private int[] numberOfVmsAtCloud;
	private int[] numberOfVmsDeploy;
	private int[] numberOfVmsReject;
	private int[] numberOfVmsRemove;
	private int[] numberOfVmsReqToBeDeploy;
	private int[] totalCpuCapcityAtCloud;
	private int[] totalCpuCapcityAtOpenHosts;
	private int[] totalCpuUseAtCloud;
	private int[] totalCpuFreeAtCloud;
	private int[] totalCpuDemandAtCloud;
	private int[] totalDemandSatisfiedAtCloud;
	private int[] totalDemandUnSatisfiedAtCloud;
	private int[] totalMemCapcityAtCloud;
	private int[] totalMemCapcityAtOpenHosts;
	private int[] totalMemUseAtCloud;
	private int[] totalMemFreeAtCloud;
	private int[] totalMemDemandAtCloud;
	private int[] numberOfVmsThatHaveFullSatisfied;
	private int[] numberOfVmsThatHaveUnSatisfied;
	private double[] hostPowerOnEnergyConsumption;
	private double[] hostBaseEnergyConsumption;
	private double[] hostLoadEnergyConsumption;
	private double[] totalConsumption;
	private double[] incomeFromSatisfyDemand;
	private double[] balanceOfIncome;
	private double[] sumOfMinREservtion;
	
	
	public ResultsData(String engineType) {
		this.engineType = engineType;
	}
	
	@Override
	public int[] getvmRelocate() {
		return vmRelocate;
	}
	
	
	
	@Override
	public String getEngineType() {
		return engineType;
	}
	
	@Override
	public int[] getNumberOfVmsThatHaveUnSatisfied() {
		return numberOfVmsThatHaveUnSatisfied;
	}
	
	@Override
	public double[] getComputationTime() {
		return computationTime;
	}
	
	@Override
	public double getTotalExperimentTimeInSec() {
		return totalExperimentTimeInSec;
	}

	@Override
	public int getExperimentTicks() {
		return experimentTicks;
	}
	
	@Override
	public int[] getNumberOfHostAtCloud() {
		return numberOfHostAtCloud;
	}
	
	@Override
	public int[] getNumberOfOpenHostAtCloud() {
		return numberOfOpenHostAtCloud;
	}
	
	@Override
	public int[] getNumberOfCloseHostAtCloud() {
		return numberOfCloseHostAtCloud;
	}
	
	@Override
	public int[] getNumberOfHostTurnOnAtCloud() {
		return numberOfHostTurnOnAtCloud;
	}
	
	@Override
	public int[] getNumberOfHostTurnOffAtCloud() {
		return numberOfHostTurnOffAtCloud;
	}
	
	@Override
	public int[] getNumberOfHostCandidatesForClosing() {
		return numberOfHostCandidatesForClosing;
	}
	
	@Override
	public int[] getNumberOfVmsAtCloud() {
		return numberOfVmsAtCloud;
	}
	
	@Override
	public int[] getNumberOfVmsDeploy() {
		return numberOfVmsDeploy;
	}
	
	@Override
	public int[] getNumberOfVmsReject() {
		return numberOfVmsReject;
	}
	
	@Override
	public int[] getNumberOfVmsRemove() {
		return numberOfVmsRemove;
	}
	
	@Override
	public int[] getNumberOfVmsReqToBeDeploy() {
		return numberOfVmsReqToBeDeploy;
	}
	
	@Override
	public int[] getTotalCpuCapcityAtCloud() {
		return totalCpuCapcityAtCloud;
	}
	
	@Override
	public int[] getTotalCpuCapcityAtOpenHosts() {
		return totalCpuCapcityAtOpenHosts;
	}
	
	@Override
	public int[] getTotalCpuUseAtCloud() {
		return totalCpuUseAtCloud;
	}
	
	@Override
	public int[] getTotalCpuFreeAtCloud() {
		return totalCpuFreeAtCloud;
	}
	
	@Override
	public int[] getTotalCpuDemandAtCloud() {
		return totalCpuDemandAtCloud;
	}
	
	@Override
	public int[] getTotalDemandSatisfiedAtCloud() {
		return totalDemandSatisfiedAtCloud;
	}
	
	@Override
	public int[] getTotalDemandUnSatisfiedAtCloud() {
		return totalDemandUnSatisfiedAtCloud;
	}
	
	@Override
	public int[] getTotalMemCapcityAtCloud() {
		return totalMemCapcityAtCloud;
	}
	
	@Override
	public int[] getTotalMemCapcityAtOpenHosts() {
		return totalMemCapcityAtOpenHosts;
	}
	
	@Override
	public int[] getTotalMemUseAtCloud() {
		return totalMemUseAtCloud;
	}
	
	@Override
	public int[] getTotalMemFreeAtCloud() {
		return totalMemFreeAtCloud;
	}
	
	@Override
	public int[] getTotalMemDemandAtCloud() {
		return totalMemDemandAtCloud;
	}

	@Override
	public int[] getNumberOfVmsThatHaveFullSatisfied() {
		return numberOfVmsThatHaveFullSatisfied;
	}
	
	@Override
	public double getTotalExperimentExecutionTimeInSec() {
		return getTotalExperimentExecutionTimeInSec()/experimentTicks;
	}

	@Override
	public int getTotalRequestCPU() {
		int total = 0;
        for (int i : getTotalCpuDemandAtCloud()) {
                total +=i;
        }
        return total;
	}

	@Override
	public int getTotalRequestMEM() {
		int total = 0;
        for (int i : getTotalMemDemandAtCloud()) {
                total +=i;
        }
        return total;
	}
	
//	@Override
	public int getTotalNumebrVmWithFullSatisfied() {
		int total = 0;
        for (int i : getNumberOfVmsThatHaveFullSatisfied()) {
                total +=i;
        }
        return total;
	}

	@Override
	public int getTotalNumebrVmWithUnSatisfied() {
		int total = 0;
        for (int i : getNumberOfVmsReqToBeDeploy()) {
                total +=i;
        }
        return total-getTotalNumebrVmWithFullSatisfied();
	}

	@Override	
	public double[] getPowerOnEnergyConsumption() {
		return hostPowerOnEnergyConsumption;
	}
	
	@Override	
	public double[] getBaseEnergyConsumption() {
		return hostBaseEnergyConsumption;
	}
	
	@Override
	public double[] getLoadEnergyConsumption() {
		return hostLoadEnergyConsumption;
	}

	@Override
	public double[] getIncomeFromSatisfyDemand() {
		return incomeFromSatisfyDemand;
	}
	
	@Override	
	public double[] getBalanceOfIncome() {
		return balanceOfIncome;
	}
	
	@Override
	public double getTotalCost() {
		return hostPowerOnEnergyConsumption[experimentTicks-1]+hostBaseEnergyConsumption[experimentTicks-1] +
				hostLoadEnergyConsumption[experimentTicks-1];
	}

	@Override
	public double getTotalIncome() {
		return incomeFromSatisfyDemand[experimentTicks-1];
	}

	@Override
	public double getBalance() {
		return balanceOfIncome[experimentTicks-1];
	}
	
	public void setComputationTime(double[] computationTime) {
		this.computationTime = computationTime;
	}

	public void setTotalExperimentTimeInSec(double totalExperimentTimeInSec) {
		this.totalExperimentTimeInSec = totalExperimentTimeInSec;
	}

	public void setExperimentTicks(int experimentTicks) {
		this.experimentTicks = experimentTicks;
	}

	public void setNumberOfHostAtCloud(int[] numberOfHostAtCloud) {
		this.numberOfHostAtCloud = numberOfHostAtCloud;
	}

	public void setNumberOfOpenHostAtCloud(int[] numberOfOpenHostAtCloud) {
		this.numberOfOpenHostAtCloud = numberOfOpenHostAtCloud;
	}

	public void setNumberOfCloseHostAtCloud(int[] numberOfCloseHostAtCloud) {
		this.numberOfCloseHostAtCloud = numberOfCloseHostAtCloud;
	}

	public void setNumberOfHostTurnOnAtCloud(int[] numberOfHostTurnOnAtCloud) {
		this.numberOfHostTurnOnAtCloud = numberOfHostTurnOnAtCloud;
	}

	public void setNumberOfHostTurnOffAtCloud(int[] numberOfHostTurnOffAtCloud) {
		this.numberOfHostTurnOffAtCloud = numberOfHostTurnOffAtCloud;
	}

	public void setNumberOfHostCandidatesForClosing(
			int[] numberOfHostCandidatesForClosing) {
		this.numberOfHostCandidatesForClosing = numberOfHostCandidatesForClosing;
	}

	public void setNumberOfVmsAtCloud(int[] numberOfVmsAtCloud) {
		this.numberOfVmsAtCloud = numberOfVmsAtCloud;
	}

	public void setNumberOfVmsDeploy(int[] numberOfVmsDeplo) {
		this.numberOfVmsDeploy = numberOfVmsDeplo;
	}

	public void setNumberOfVmsReject(int[] numberOfVmsReject) {
		this.numberOfVmsReject = numberOfVmsReject;
	}

	public void setNumberOfVmsRemove(int[] numberOfVmsRemove) {
		this.numberOfVmsRemove = numberOfVmsRemove;
	}

	public void setNumberOfVmsReqToBeDeploy(int[] numberOfVmsReqToBeDeploy) {
		this.numberOfVmsReqToBeDeploy = numberOfVmsReqToBeDeploy;
	}

	public void setTotalCpuCapcityAtCloud(int[] totalCpuCapcityAtCloud) {
		this.totalCpuCapcityAtCloud = totalCpuCapcityAtCloud;
	}

	public void setTotalCpuCapcityAtOpenHosts(int[] totalCpuCapcityAtOpenHosts) {
		this.totalCpuCapcityAtOpenHosts = totalCpuCapcityAtOpenHosts;
	}

	public void setTotalCpuUseAtCloud(int[] totalCpuUseAtCloud) {
		this.totalCpuUseAtCloud = totalCpuUseAtCloud;
	}

	public void setTotalCpuFreeAtCloud(int[] totalCpuFreeAtCloud) {
		this.totalCpuFreeAtCloud = totalCpuFreeAtCloud;
	}

	public void setTotalCpuDemandAtCloud(int[] totalCpuDemandAtCloud) {
		this.totalCpuDemandAtCloud = totalCpuDemandAtCloud;
	}

	public void setTotalDemandSatisfiedAtCloud(
			int[] totalCpuDemandSatisfiedAtCloud) {
		this.totalDemandSatisfiedAtCloud = totalCpuDemandSatisfiedAtCloud;
	}

	public void setTotalDemandUnSatisfiedAtCloud(
			int[] totalCpuDemandUnSatisfiedAtCloud) {
		this.totalDemandUnSatisfiedAtCloud = totalCpuDemandUnSatisfiedAtCloud;
	}

	public void setTotalMemCapcityAtCloud(int[] totalMemCapcityAtCloud) {
		this.totalMemCapcityAtCloud = totalMemCapcityAtCloud;
	}

	public void setTotalMemCapcityAtOpenHosts(int[] totalMemCapcityAtOpenHosts) {
		this.totalMemCapcityAtOpenHosts = totalMemCapcityAtOpenHosts;
	}

	public void setTotalMemUseAtCloud(int[] totalMemUseAtCloud) {
		this.totalMemUseAtCloud = totalMemUseAtCloud;
	}

	public void setTotalMemFreeAtCloud(int[] totalMemFreeAtCloud) {
		this.totalMemFreeAtCloud = totalMemFreeAtCloud;
	}

	public void setTotalMemDemandAtCloud(int[] totalMemDemandAtCloud) {
		this.totalMemDemandAtCloud = totalMemDemandAtCloud;
	}

	public void setNumberOfVmsThatHaveFullSatisfied(
			int[] numberOfVmsThatHaveFullSatisfied) {
		this.numberOfVmsThatHaveFullSatisfied = numberOfVmsThatHaveFullSatisfied;
	}


	public void setNumberOfVmsThatHaveUnSatisfied(
			int[] numberOfVmsThatHaveUnSatisfied) {
		this.numberOfVmsThatHaveUnSatisfied = numberOfVmsThatHaveUnSatisfied;
	}
	
	public void setPowerOnEnergyConsumption(double[] hostPowerOnEnergyConsumption) {
		this.hostPowerOnEnergyConsumption = hostPowerOnEnergyConsumption;
	}

	public void setBaseEnergyConsumption(double[] hostBaseEnergyConsumption) {
		this.hostBaseEnergyConsumption = hostBaseEnergyConsumption;
	}
	
	public void setLoadEnergyConsumption(double[] hostLoadEnergyConsumption) {
		this.hostLoadEnergyConsumption = hostLoadEnergyConsumption;
	}
	
	public void setIncomeFromSatisfyDemand(double[] incomeFromSatisfyDemand) {
		this.incomeFromSatisfyDemand = incomeFromSatisfyDemand;
	}
	
	public void setBalanceOfIncome(double[] balanceOfIncome) {
		this.balanceOfIncome = balanceOfIncome;
	}
	
	public void setVmRelocate(int[] vmRelocate) {
		this.vmRelocate = vmRelocate;
	}

	@Override
	public double[] getTotalConsumption() {
		return totalConsumption;
	}
	public void setTotalConsumptione(double[] totalConsumption) {
		this.totalConsumption = totalConsumption;
	}

	@Override
	public double[] getSumOfMinREservtion() {
		return sumOfMinREservtion;
	}
	
	public void setSumOfMinREservtion(double[] sumOfMinREservtion) {
		this.sumOfMinREservtion = sumOfMinREservtion;
	}
	
}
